package online.liulei.design.mode;

import java.util.ArrayList;
import java.util.List;

public class ConcreteSubject implements Subject {

    private List<Observer> observers = new ArrayList<>();

    @Override
    public void registerObserver(Observer obServer){
        observers.add(obServer);
    }

    @Override
    public void removeObserver(Observer obServer){
        observers.remove(obServer);
    }

    @Override
    public void notifyObservers(){
        for(Observer observer : observers){
            observer.update();
        }
    }

}
